var vS=';',cS='所处城市',pImg='http://myimg.zhaopin.com/images/blank.gif';
var allLibJobsearch = [];

function lib_searchItem(o,i,v,t,fn,fn2,pid){
	this.C_ID=o;
	this.id=i;
	this.val=v;
	this.txt=t;
	this.fn=fn?fn:'fnClickItem';
	this.fn2=fn2?fn2:null;
	this.pid=pid?pid:null;
	this.child=[];
	this.parent=null;
	this.childF=false;
	this.childN=0;
	this.check=false;
};
lib_searchItem.prototype.add=function(c){
	c.parent=this;
	this.child[c.id]=c;
	if(!this.childF) this.childF=true;
	this.childN++;
};
lib_searchItem.prototype.toString=function(){
	var obj=eval(this.C_ID);
	if(obj.nowID.indexOf(vS)>-1) var flag=(vS+obj.nowID+vS).indexOf(vS+this.id+vS)>-1?true:false;
	else var flag=obj.nowID==this.id?true:false;
	return '<span id="'+this.C_ID+'_aItem_'+this.id+'" onclick="'+this.C_ID+'.'+this.fn+'(\''+this.id+'\',event)" onmouseover="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',true)" onmouseout="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',false)" class="'+(flag?'focus':'')+' substitute4a itemSpan"><div class="cityItemPadding">'+this.txt+'</div></span>';
};
function lib_jobsearch(o,d,h,b,t,isRunFn,p){
	allLibJobsearch.push(this);
	this.C_ID=o;
	this.h=eval(h)?eval(h):null;
	this.b=eval(b)?eval(b):null;
	this.data=d;
	this.$_d=[];
	this.tit=t;
	this.nowID='';
	this.config={};
	this.parent=p?p:null;
	this.child=null;
	if(p) p.child=this;
	this.hFlag='open';
	this.pFlag='open';
	this.oFlag='close';
	this.pID='';
	this.dataF=false;
	this.cacheID='';
	this.f = isRunFn;
};
lib_jobsearch.prototype.A=myAttachEvent;

lib_jobsearch.prototype.fnIniButton=function(){
	var T=this;
	if(this.b!=null){
		this.P=function(e){T.fnClickButton(e);};
		//this.A(this.b,'click',this.P);     //waste memory 
		if(typeof(window.event)!='undefined') this.b.onclick=new Function(this.C_ID+".fnClickButton(event)");
		else if(typeof(window.Event)!='undefined') this.b.onclick=new Function(this.C_ID+".fnClickButton(Event)");
	}
	
	var i,txtStr='',v=this.h.value;
	if(txtStr!='') this.fnTxt2Button(txtStr);
	
	if(this.parent){
		if(this.parent.h.value!='') this.b.disabled=false;
		else this.b.disabled=true;
	}
	else this.b.disabled=false;
};

lib_jobsearch.prototype.fnFixButton=function(){
	if(!this.dataF&&this.h.value!=''){
		var i,txtStr=null,v=this.h.value;
		if(txtStr=='不限'){
			this.h.value = '';
			this.fnTxt2Button(txtStr);
		}
	
		if(this.parent){
			if(this.parent.b.value!='不限') this.b.disabled=false;
			else{
				this.b.disabled=true;
				this.h.value = '';
				this.fnTxt2Button('不限');
			}
		}
		else this.b.disabled=false;
	}
};

lib_jobsearch.prototype.fnIniDiv=function(){
	if(!this.divF){
		var newDiv=document.createElement('div');
		newDiv.id=this.C_ID+'_popupDiv';
		newDiv.className='searchPopupDiv';
		if(typeof(this.config.width)!='undefined'&&this.config.width!=0) newDiv.style.width=this.config.width+'px';
		if(this.b.parentNode&&this.b.parentNode.nodeType==1&&this.b.parentNode.tagName.toLowerCase()!='html') this.b.parentNode.appendChild(newDiv);
		else document.body.appendChild(newDiv);
		newDiv.innerHTML=this.divHTML();
		this.div=newDiv;
		this.dDiv=document.getElementById(this.C_ID+'_dDiv');
		this.nowSpan=document.getElementById(this.C_ID+'_nowSpan');
		//if(this.tit==cS){
			this.dDiv_c=document.getElementById(this.C_ID+'_dDiv_c');
			this.dDiv_h=document.getElementById(this.C_ID+'_dDiv_h');
			this.dDiv_p=document.getElementById(this.C_ID+'_dDiv_p');
			this.dDiv_o=document.getElementById(this.C_ID+'_dDiv_o');
		//}
	
		var T=this;
		//this.dMouse=document.getElementById(this.C_ID+'_mMove');
		//this.MOVER=function(){w_mmover(T.div.id);};
		//this.MOUT=function(){w_mmout();};
		//this.MSELECT=function(){return false;};
		//this.A(this.dMouse,'selectstart',this.MSELECT);
		//this.div.onselectstart=this.MSELECT;
		//this.A(this.dMouse,'mouseover',this.MOVER);
		//this.A(this.dMouse,'mouseout',this.MOUT);
		
		this.divF = true;
	}
};

lib_jobsearch.prototype.fnIni$_d=function(){
	if(!this.dataF){
	var i,v=this.h.value;
	this.vT=0;
	for(i=0;this.data[i];i++){
		this.$_d[this.data[i][0]]=new lib_searchItem(this.C_ID,this.data[i][0],this.data[i][2],this.data[i][2],'fnClickItem_city',null,this.data[i][1]);
		if((vS+v+vS).indexOf(vS+this.$_d[this.data[i][0]].val+vS)>-1) this.nowID+=this.nowID==''?this.$_d[this.data[i][0]].id:vS+this.$_d[this.data[i][0]].id;
		if(this.$_d[this.data[i][0]].pid!=0&&this.$_d[this.$_d[this.data[i][0]].pid]) this.$_d[this.$_d[this.data[i][0]].pid].add(this.$_d[this.data[i][0]]);
	}
	this.dataF=true;
	}
};

lib_jobsearch.prototype.setHTML=function(){
	//if(this.tit==cS){
		this.dDiv.innerHTML='';
		this.dDiv.style.display='none';
		this.setStatus();
		//this.dDiv_c.innerHTML=this.chiHTML();
		this.dDiv_h.innerHTML=this.hotHTML();
		this.dDiv_p.innerHTML=this.proHTML();
		this.dDiv_o.innerHTML=this.oveHTML();
	//}
	//else this.dDiv.innerHTML=this.dDivHTML();
	this.checkboxLabel(this.dDiv);
	this.setNow();
};

lib_jobsearch.prototype.checkboxLabel=function(html){
	if(html){
		var arrBox = html.getElementsByTagName('input');
		for(var i=0;arrBox[i];i++){
			if(arrBox[i].type.toLowerCase()=='checkbox'&&arrBox[i].parentNode.tagName.toLowerCase()=='label') arrBox[i].parentNode.htmlFor = arrBox[i].id;
		}
	}
};

lib_jobsearch.prototype.fnClickButton=function(e){
	e.preventDefault?e.stopPropagation():(e.cancelBubble=true);
	if(!this.divF) this.fnIniDiv();
	
	this.setLoading();
	this.div.style.zIndex=99;
	switchVisibility(this.div.id,e,getXY(this.b).x,getXY(this.b).y+22);
	if(!this.dataF){
		if(this.parent  && !this.parent.dataF) this.parent.fnIni$_d();
		this.fnIni$_d();
	}
	else{
		if(this.C_ID=='cityF'){
			var inputTxt=this.h.value;
			this.nowID='';
			for(var i in this.$_d) if(this.$_d[i].txt==inputTxt){
				this.nowID=this.$_d[i].id;
				break;
			}
		}
	}
	this.setHTML();
	if(this.div.style.visibility!='hidden'){
		setShim(this.div);
		positionObject(this.div.id,getXY(this.b).x,getXY(this.b).y+22);
	}
	if(window.currentlyVisiblePopup2){
		changeObjectVisibility(window.currentlyVisiblePopup2,'hidden');
		window.currentlyVisiblePopup2=false;
	}
};

lib_jobsearch.prototype.setLoading=function(){
	this.dDiv.innerHTML='请稍等...';
	this.dDiv.style.display='';
};

lib_jobsearch.prototype.getStatus=function(){
	//var id=this.h.value.toString().indexOf(vS)>-1?this.h.value.toString().split(vS)[0]:this.h.value,i;
	var id=this.nowID.toString().indexOf(vS)>-1?this.nowID.toString().split(vS)[0]:this.nowID,i;
	if(this.$_d[id]){
	if(id==489) {this.pID='';return 'default';}
	if(id==480) {this.pID='';return 'oversea';}
	//for(i=0;arrHotcity[i];i++) if(arrHotcity[i][0]==id) {this.pID='';return 'hotcity';}
	for(i=0;arrOversea[i];i++) if(arrOversea[i][0]==id) {this.pID='';return 'oversea';}
	for(i=0;arrProvince[i];i++){
		if(arrProvince[i][0]==id){
			if(this.$_d[id].childF) this.pID=id;
			else this.pID='';
			break;
		}
	}
	if(i==arrProvince.length){
		if(this.$_d[id]&&this.$_d[id].parent!=null) this.pID=this.$_d[id].pid;
	}
	if(this.pID==489) this.pID='';
	return 'province';}
	else{this.pID='';return 'default';}
};

lib_jobsearch.prototype.setStatus=function(){
	var type=this.getStatus();
	switch(type){
		case 'default':this.hFlag='open';this.pFlag='open';this.oFlag='close';break;
		//case 'hotcity':this.hFlag='open';this.pFlag='close';this.oFlag='close';break;
		case 'province':this.hFlag='open';this.pFlag='open';this.oFlag='close';break;
		case 'oversea':this.hFlag='open';this.pFlag='close';this.oFlag='open';break;
	}
};

lib_jobsearch.prototype.fn2Provinces=function(){
	this.pID='';
	this.dDiv_p.innerHTML=this.proHTML();
	setShim(this.div);
};

lib_jobsearch.prototype.fnClickProvince=function(pid){
	this.pID=pid;
	//this.h.value=this.$_d[pid].val;
	if(this.nowID!=''){
		var arr=this.nowID.toString().split(vS),i;
		for(i=0;arr[i];i++) if(document.getElementById(this.C_ID+'_aItem_'+arr[i])) document.getElementById(this.C_ID+'_aItem_'+arr[i]).className=document.getElementById(this.C_ID+'_aItem_'+arr[i]).className.replace(' focus','').replace('focus','');
	}
	//this.nowID=pid;
	//this.fnTxt2Button(this.$_d[pid].txt);
	//this.setNow();
	this.dDiv_p.innerHTML=this.proHTML();
	setShim(this.div);
	
	if(window['jsModuleIns']) for(var i in window['jsModuleIns']){
		if(window['jsModuleIns'][i] instanceof metroHotFac || window['jsModuleIns'][i] instanceof metroLineFac){
			window['jsModuleIns'][i].city = this.h.value;
			window['jsModuleIns'][i].fnShowHide();
			if(window['jsModuleIns'][i].hideStation) window['jsModuleIns'][i].hideStation();
		}
	}
};

lib_jobsearch.prototype.fnCloseOpen=function(id){
	var html=document.getElementById(id);
	var img=document.getElementById(id+'Icon');
	var status='';
	if(html){
		if(html.style.display=='none'){
			html.style.display='';
			status='open';
		}
		else{
			html.style.display='none';
			status='close';
		}
		if(img) img.className='icon'+status;
		switch(id){
			case this.C_ID+'_hCon':this.hFlag=status;break;
			case this.C_ID+'_pCon':this.pFlag=status;break;
			case this.C_ID+'_oCon':this.oFlag=status;break;
		}
		setShim(this.div);
	}
};

lib_jobsearch.prototype.fnClickItem=function(id,e){
	e.preventDefault?e.stopPropagation():(e.cancelBubble=true);
	this.h.value=this.$_d[id].val;
	this.fnTxt2Button(this.$_d[id].txt);
	if(this.nowID!=''){
		if(this.$_d[this.nowID]){
			if(this.$_d[this.nowID].check) this.$_d[this.nowID].check=false;
			if(this.child!=null){
				if(!this.child.dataF) this.child.fnIni$_d();
				var i,data=this.$_d[this.nowID].child;
				for(i in data) if(data[i].check) data[i].check=false;
			}
		}
		else if(this.nowID.toString().indexOf(vS)>-1){
			var arr=this.nowID.toString().split(vS),i,j;
			for(i=0;arr[i];i++){
				if(this.$_d[arr[i]].check) this.$_d[arr[i]].check=false;
				if(this.child!=null){
					if(!this.child.dataF) this.child.fnIni$_d();
					var data=this.$_d[arr[i]].child;
					for(j in data) if(data[j].check) data[j].check=false;
				}
			}
		}
	}
	this.nowID=id;
	this.cacheID='';
	if(this.child!=null) this.fnClearCVal();
	closeAllDiv();
};

lib_jobsearch.prototype.fnClickItem_city=function(id,e){
	e.preventDefault?e.stopPropagation():(e.cancelBubble=true);
	this.h.value=this.$_d[id].val;
	this.fnTxt2Button(this.$_d[id].txt);
	if(this.nowID!=''){
		if(this.$_d[this.nowID]){
			if(this.$_d[this.nowID].check) this.$_d[this.nowID].check=false;
			if(this.child!=null){
				if(!this.child.dataF) this.child.fnIni$_d();
				var i,data=this.$_d[this.nowID].child;
				for(i in data) if(data[i].check) data[i].check=false;
			}
		}
		else if(this.nowID.toString().indexOf(vS)>-1){
			var arr=this.nowID.toString().split(vS),i,j;
			for(i=0;arr[i];i++){
				if(this.$_d[arr[i]].check) this.$_d[arr[i]].check=false;
				if(this.child!=null){
					if(!this.child.dataF) this.child.fnIni$_d();
					var data=this.$_d[arr[i]].child;
					for(j in data) if(data[j].check) data[j].check=false;
				}
			}
		}
	}
	this.nowID=id;
	this.cacheID='';
	if(this.child!=null) this.fnClearCVal();
	closeAllDiv();
	
	if(window['jsModuleIns']) for(var i in window['jsModuleIns']){
		if(window['jsModuleIns'][i] instanceof metroHotFac || window['jsModuleIns'][i] instanceof metroLineFac){
			window['jsModuleIns'][i].city = this.h.value;
			window['jsModuleIns'][i].fnShowHide();
			if(window['jsModuleIns'][i].hideStation) window['jsModuleIns'][i].hideStation();
		}
	}

	if(this.f) checkElement(this.h,'inputNoborder',true,[]);//我的网聘注册页面：所处城市必填验证
};

lib_jobsearch.prototype.setNow=function(){
	if(this.nowSpan) this.nowSpan.innerHTML=this.nowHTML();
};

lib_jobsearch.prototype.fnClearCVal=function(){
	if(this.child!=null){
		var c=this.child;
		if(!c.dataF) c.fnIni$_d();
		c.h.value='';
		c.nowID='';
		c.cacheID='';
		c.fnTxt2Button('不限');
		if(this.$_d[this.nowID]&&this.$_d[this.nowID].childF) c.b.disabled=false;
		else c.b.disabled=true;
	}
};

lib_jobsearch.prototype.fnCloseDiv=function(){
	closeAllDiv();
	this.cacheID='';
};

lib_jobsearch.prototype.fnTxt2Button=function(txt){
	return;
};

lib_jobsearch.prototype.trHTML=function(arrData,fn){
	var i,colIndex,str='',data=arrData,col=this.config.col,tdWidth=parseInt(100/col)+'%';
	var fName=fn?fn:'fnClickItem';
	for(i=0;data[i];i++){
		colIndex=i%col;
		if(colIndex==0) str+='<tr>';
		if(!this.$_d[data[i][0]].childF) fName='fnClickItem_city';
		str+='<td width="'+tdWidth+'"><span id="'+this.C_ID+'_aItem_'+data[i][0]+'" onclick="'+this.C_ID+'.'+fName+'(\''+data[i][0]+'\',event);" class="'+((vS+this.nowID+vS).indexOf(vS+data[i][0]+vS)>-1?'focus':'')+' substitute4a itemSpan" onmouseover="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',true)" onmouseout="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',false)"><div class="cityItemPadding">'+data[i][2]+'</div></span></td>';//.replace('其他','其他国家')
		if(colIndex==col-1) str+='</tr>';
	}
	return str;
};

lib_jobsearch.prototype.chiHTML=function(){
	return '<div class="chinaTitle">'+this.$_d[489]+'</div>';
};

lib_jobsearch.prototype.hotHTML=function(){
	var str='',data=arrHotcity;
	str+='<div class="hotcitysTitle"><span class="substitute4a" onclick="'+this.C_ID+'.fnCloseOpen(\''+this.C_ID+'_hCon\')"><img src='+pImg+' class="'+(this.hFlag=='close'?'iconclose':'iconopen')+'" id="'+this.C_ID+'_hConIcon"></span>&nbsp;&nbsp;主要城市</div>';
	str+='<div id="'+this.C_ID+'_hCon" class="hotcitysCon" style="display:'+(this.hFlag=='close'?'none':'')+';">';
	str+='<table cellpadding="0" cellspacing="0" border="0" class="hotcitysItemTab">';
	str+=this.trHTML(data,'fnClickItem_city');
	str+='</table></div>';
	return str;
};

lib_jobsearch.prototype.proHTML=function(){
	var str='',i,itemIndex=-1,colIndex,col=this.config.col,tdWidth=parseInt(100/col);
	var data=this.pID==''?arrProvince:this.$_d[this.pID].child;
	str+='<div class="provincesTitle"><table cellspacing="0" cellpadding="0" border="0"><tr><td><span onclick="'+this.C_ID+'.fnCloseOpen(\''+this.C_ID+'_pCon\')" class="substitute4a"><img src='+pImg+' class="'+(this.pFlag=='close'?'iconclose':'iconopen')+'" id="'+this.C_ID+'_pConIcon"></span>&nbsp;&nbsp;</td><td>'+(this.pID==''?'省市':'<!--<span class="currentProvince substitute4a itemSpan'+((vS+this.nowID+vS).indexOf(vS+this.pID+vS)>-1?' focus':'')+'" onclick="'+this.C_ID+'.fnClickItem(\''+this.pID+'\',event)" onmouseover="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',true)" onmouseout="lib_jobsearch.fnChangeBg(this,\'dataItemCSS4mouseover\',false)">-->'+this.$_d[this.pID].txt+'<!--</span>--></td><td>&nbsp;&nbsp;&nbsp;&nbsp;[ <span class="backtoProvinces substitute4a" onclick="'+this.C_ID+'.fn2Provinces()">返回其他省市</span> ]')+'</td></tr></table></div>';
	str+='<div id="'+this.C_ID+'_pCon" class="provincesCon" style="display:'+(this.pFlag=='close'?'none':'')+';">';
	str+='<table cellpadding="0" cellspacing="0" border="0" class="provincesItemTab">';
	if(this.pID=='') str+=this.trHTML(data,'fnClickProvince');
	else{
		for(i in data){
			itemIndex++;
			colIndex=itemIndex%col;
			if(colIndex==0) str+='<tr>';
			if(data[i].txt.length<this.config.tdTxtLength) str+='<td width="'+tdWidth+'%">'+data[i]+'</td>';
			else{
				if(colIndex<col-1){
					str+='<td width="'+tdWidth*2+'%" colspan="2">'+data[i]+'</td>';
					colIndex++;itemIndex++;
				}
				else if(colIndex==col-1){
					str+='<td width="'+tdWidth+'%"></td></tr>';
					str+='<tr><td width="'+tdWidth*2+'%" colspan="2">'+data[i]+'</td>';
					colIndex=0;itemIndex=itemIndex+2;
				}
			}
			if(colIndex==col-1) str+='</tr>';
		}
	}
	str+='</table></div>';
	return str;
};

lib_jobsearch.prototype.oveHTML=function(){
	var str='',data=arrOversea;
	str+='<div class="overseasTitle"><table cellspacing="0" cellpadding="0" border="0"><tr><td><span class="substitute4a" onclick="'+this.C_ID+'.fnCloseOpen(\''+this.C_ID+'_oCon\')"><img src='+pImg+' class="'+(this.oFlag=='close'?'iconclose':'iconopen')+'" id="'+this.C_ID+'_oConIcon"></span>&nbsp;&nbsp;</td><td class="conGuowai">'+this.$_d[480]+'</td></tr></table></div>';
	str+='<div id="'+this.C_ID+'_oCon" class="overseasCon" style="display:'+(this.oFlag=='close'?'none':'')+';">';
	str+='<table cellpadding="0" cellspacing="0" border="0" class="overseasItemTab">';
	str+=this.trHTML(data,'fnClickItem_city');
	str+='</table></div>';
	return str;
};

lib_jobsearch.prototype.dDivHTML=function(){
	var str='',i,dataIndex=-1,colIndex,col=this.config.col,tdWidth=parseInt(100/col)+'%';
	return str;
};

lib_jobsearch.prototype.divHTML=function(){
	var str='';
	str+='<table cellpadding="0" cellspacing="0" border="0" class="searchItemTab" style="border:2px solid #64B5E5">';
	str+='<tr><td colspan="3" class="title" id="'+this.C_ID+'_mMove" style="padding-top:5px;background:#64B5E5;cursor:auto;"><div class="left">'+this.tit+'：</div><div class="right">[ <span onclick="'+this.C_ID+'.fnCloseDiv()" class="substitute4a" title="">关闭</span> ]</div></td></tr>';//<span id="'+this.C_ID+'_nowSpan"></span>
	str+='<tr><td colspan="3" class="content" style="border:0;">';
	str+='<div>'+this.iDivHTML()+'</div>';
	str+='<div id="'+this.C_ID+'_dDiv"></div>';
	//if(this.tit==cS){
		str+='<div id="'+this.C_ID+'_dDiv_h"></div>';
		str+='<div id="'+this.C_ID+'_dDiv_p"></div>';
		str+='<div id="'+this.C_ID+'_dDiv_c"></div>';
		str+='<div id="'+this.C_ID+'_dDiv_o"></div>';
	//}
	str+='</td></tr>';
	//str+='<tr><td class="bottomleft"><img src='+pImg+' width="8" height="8"></td><td class="bottomcenter"><img src='+pImg+' width="'+parseInt(this.config.width-16)+'" height="4"></td><td class="bottomright"><img src='+pImg+' width="8" height="8"></td></tr>';
	str+='</table>';
	return str;
};

lib_jobsearch.prototype.iDivHTML=function(){
	var str='';
	return str;
};

lib_jobsearch.prototype.nowHTML=function(){
	var str='',strT='',showTxt,str1='&nbsp;&nbsp;&nbsp;&nbsp;<span class="selectedTxt">(当前选择的'+this.tit+'--<span class="itemName">',str2='</span>)</span>';
	if(this.nowID!=''){
		var arr=this.nowID.toString().split(vS),i;
		for(i=0;arr[i];i++) if(this.$_d[arr[i]]) strT+=strT==''?this.$_d[arr[i]].txt:'+'+this.$_d[arr[i]].txt;
		str=str1+strT+str2;
	}
	else{
			str=str1+'不限'+str2;
	}
	return str;
};

function setShim(div){
	if(div.shim) div.shim.setStyle('visibility','visible');
};

function closeAllDiv(){
	hideCurrentPopup();
	if(window.currentlyVisiblePopup2){
		changeObjectVisibility(window.currentlyVisiblePopup2,'hidden');
		window.currentlyVisiblePopup2=false;
	}
};

function switchFocus(divId){
	if(window.currentlyVisiblePopup&&window.currentlyVisiblePopup2){
		var toFocusId=divId;
		var toBlurId=toFocusId==window.currentlyVisiblePopup?window.currentlyVisiblePopup2:window.currentlyVisiblePopup;
		var toFocusDiv=document.getElementById(toFocusId);
		var toBlurDiv=document.getElementById(toBlurId);
		if(toFocusDiv&&toBlurDiv){
			toFocusDiv.style.zIndex=toBlurDiv.style.zIndex*1+2;
			if(toFocusDiv.mask) toFocusDiv.mask.hideMask();
			if(!toBlurDiv.mask) toBlurDiv.mask=new divMask(toBlurDiv);
			toBlurDiv.mask.showMask();
		}
	}
};

function myAttachEvent(d,e,f){
	try {
		if(d.attachEvent) d.attachEvent("on"+e,f);
		else if(d.addEventListener) d.addEventListener(e,f,false);
		else{
			var oldF=eval('d.on'+e);
			if(typeof oldF!='function') eval('d.on'+e+'=f');
			else eval('d.on'+e)=function(){oldF();f();}
		}
	}catch (error){}
};

function divMask(theObj){
/*  
    this.obj=theObj;
	this.obj.selectObj=this.obj.getElementsByTagName('select');
    var newDiv=document.createElement("div");
    newDiv.className="divMask";
    newDiv.style.zIndex=getCurrentStyle(this.obj,'zIndex')*1+1;
    var offsetLeft=getLocalOffsetLeft(this.obj);
    newDiv.style.left=offsetLeft;
    var offsetTop=getLocalOffsetTop(this.obj);
    newDiv.style.top=offsetTop;
	newDiv.style.width=this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth;
    newDiv.style.height=this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight;
	if(typeof(newDiv.style.filter)!='undefined') newDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
	else newDiv.style.MozOpacity=0.7;
    newDiv.style.position="absolute";
	newDiv.style.visibility='hidden';
	
	if(theObj.tagName.toLowerCase()!='body'){
		var id=this.obj.id;
		newDiv.onclick=function(){switchFocus(id);};
	}
	
    this.div=newDiv;
	this.maskFlag=false;
    if(this.obj.parentNode.tagName.toLowerCase()!='html') this.obj.parentNode.insertBefore(this.div,this.obj);
	else if(arguments[1]&&arguments[1].nodeType==1&&arguments[1].tagName.toLowerCase()!='body') arguments[1].appendChild(this.div);
	else document.body.appendChild(this.div);
	if(this.obj.currentStyle){//IE
        this.setOpacity=this.setOpacityIE;this.getOpacity=this.getOpacityIE;
    }else{//Non IE,just pass calls through
        this.setOpacity=this.setOpacityNonIE;this.getOpacity=this.getOpacityNonIE;
    }
    */
};
divMask.prototype={
  /*
    setStyle:function(prop,val){
                        this.obj.style[prop]=val;
                        if(prop != 'position'){//div must remain position:absolute
	                        this.div.style[prop]=val;
                        }//Refresh div's width and height from the browser calculated offsets.
                        this.div.style.width=(this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth)+"px";
	                    this.div.style.height=(this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight)+"px";
	                    this.div.style.left=getLocalOffsetLeft(this.obj)+"px";
				        this.div.style.top=getLocalOffsetTop(this.obj)+"px";

                 },
	getStyle:function(prop) {return this.div.style[prop];},
    setOpacityNonIE:function(val){
                            if(val<0) val=0;if(val>1) val=1;
                            this.obj.style.opacity=val;
                      },
    setOpacityIE:function(val){
                        if(val<0) val=0;if(val>1) val=1;
                        this.obj.filters.alpha.opacity=(val*100); //div stays at opacity 0
                   },
    getOpacityNonIE:function(){return getCurrentStyle(this.obj,'opacity'); },
    getOpacityIE:function(){return this.obj.filters.alpha.opacity/100.0; },*/
	showMask2:function(){//Refresh div's width and height from the browser calculated offsets.
                        /*this.div.style.width=(this.obj.scrollWidth?this.obj.scrollWidth:this.obj.offsetWidth?this.obj.offsetWidth:this.obj.clientWidth)+"px";
	                    this.div.style.height=(this.obj.scrollHeight?this.obj.scrollHeight:this.obj.offsetHeight?this.obj.offsetHeight:this.obj.clientHeight)+"px";
	                    this.div.style.left=getLocalOffsetLeft(this.obj)+"px";
				        this.div.style.top=getLocalOffsetTop(this.obj)+"px";
						this.div.style.zIndex=getCurrentStyle(this.obj,'zIndex')*1+1;
						this.div.style.visibility='visible';
						if(this.div.currentStyle) for(var i=0;this.obj.selectObj[i];i++) this.obj.selectObj[i].disabled=true;
						this.maskFlag=true;*/
				},
	hideMask:function(){
    /*this.div.style.visibility='hidden';if(this.div.currentStyle) for(var i=0;this.obj.selectObj[i];i++) this.obj.selectObj[i].disabled=false;this.maskFlag=false;*/
  },
	
  showMask:function(){
    /*
		if(this.obj.tagName.toLowerCase()=='body'){
			if(!this.maskFlag2 || this.maskFlag){
				if(!this.maskFlag2) this.maskFlag2 = true;
				if(isDocumentLoaded()){
					this.showMask2();
					if(this.timeoutID) this.timeoutID = null;
					this.maskFlag2 = false;
				}
				else{
					this.showMask2();
					var T = this;
					this.timeoutID = setTimeout('document.body.mask.showMask()',100);
				}
			}
			else{
				if(this.timeoutID) this.timeoutID = null;
				this.maskFlag2 = false;
			}
		}
		else this.showMask2();
     */
	}
};

function isDocumentLoaded(){
	return (null!=document.readyState&&"complete"!=document.readyState)?false:true;
};

if(!document.readyState) myAttachEvent(window,'load',function(){if(document.body.mask&&document.body.mask.maskFlag) document.body.mask.showMask()});

function dashify(str){
    return str.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();
};
function getCurrentStyle(element,styleProp){//read only
    var retVal;
    if(element.currentStyle){
       //IE
       retVal=element.currentStyle[styleProp];
    }
	else if(document.defaultView&&document.defaultView.getComputedStyle){
       //Mozilla
       retVal=document.defaultView.getComputedStyle(element,null).getPropertyValue(dashify(styleProp));
    }
	else{
       //Safari:(
       retVal=null;
    }
    return retVal;
};

function getLocalOffset(offset,direction){//direction: Top Left
	var y=offset['offset'+direction];
    var div;
    try{
        div=offset.offsetParent;
    }
	catch(ex){
        //with dhtml actions that change DOM IE may throw unspecified error when checking offsetParent property
        return y;
    }
    while(div&&getCurrentStyle(div,'position')=='static'){
        y+=div['offset'+direction];
        try{
            div=div.offsetParent;
        }
		catch(ex){
            // with dhtml actions that change DOM IE may throw unspecified error when checking offsetParent property
            return y;
        }
    }
    return y;
};
function getLocalOffsetTop(offset){
	return getLocalOffset(offset,'Top');
};
function getLocalOffsetLeft(offset){
    return getLocalOffset(offset,'Left');
};

function getXY(object){// function to get an object's absolute position:x & y
    var pt=new Point(0,0);
	pt.x=getLocalOffsetLeft(object);
	pt.y=getLocalOffsetTop(object);
    return pt;
};
function Point(iX,iY){
	this.x=iX;
	this.y=iY;
};


var zp_moveObj=new Object();
zp_moveObj.dragover=null;
zp_moveObj.dragobj=null;
document.onmousemove=mmove;
document.onmousedown=mdown;
document.onmouseup=mup;
function w_mmover(id){
    zp_moveObj.dragover=id;
};
function w_mmout(){
    zp_moveObj.dragover=null;
};
function mup(e){
	zp_moveObj.dragobj=null;	
};
function mdown(e){
	if(zp_moveObj.dragover!=null){
	zp_moveObj.dragobj=document.getElementById(zp_moveObj.dragover);
	var x=(!document.all)?e.pageX:event.x||event.clientX;
    var y=(!document.all)?e.pageY:event.y||event.clientY;
	if(document.all) y+=document.body.scrollTop;
    var id=zp_moveObj.dragover;
	if(zp_moveObj.dragobj!=null){
		zp_moveObj.clickedX=x-parseInt(document.getElementById(id).style.left+0); 
		zp_moveObj.clickedY=y-parseInt(document.getElementById(id).style.top+0);
	}}
};
function mmove(e,y){
	var x=(!document.all)?e.pageX:event.x||event.clientX;
    var y=(!document.all)?e.pageY:event.y||event.clientY;
	if(document.all) y+=document.body&&document.body.scrollTop?document.body.scrollTop:0;
	if(zp_moveObj.dragobj!=null){
		nx=x-zp_moveObj.clickedX;
		ny=y-zp_moveObj.clickedY;
		var OK=moveOK(zp_moveObj.dragobj,nx,ny);
		if(!OK.x) nx=getLocalOffsetLeft(zp_moveObj.dragobj);
		if(!OK.y) ny=getLocalOffsetTop(zp_moveObj.dragobj);
		zp_moveObj.dragobj.style.left=nx+"px";
		zp_moveObj.dragobj.style.top=ny+"px";
		if(zp_moveObj.dragobj.shim&&zp_moveObj.dragobj.shim.iframe){
			zp_moveObj.dragobj.shim.iframe.style.left=nx+"px";
			zp_moveObj.dragobj.shim.iframe.style.top=ny+"px";
		}
	}
};
function moveOK(d,x,y){
	var objOK={x:true,y:true};
	var w=d.offsetWidth;
	var h=d.offsetHeight;
	var dWH = getDocumentWH();
	var t=10;
	var r=dWH.w-w-10;
	var b=dWH.h-h-10;
	var l=10;
	if(x<l||(r>0&&r>l&&x>r)) objOK.x=false;
	if(y<t||(b>0&&b>t&&y>b)) objOK.y=false;
	return objOK;
};

function resizeWin(){
	if(document.body.mask&&document.body.mask.maskFlag){
		var documentWH = getDocumentWH();
		document.body.mask.div.style.width=documentWH.w;
		document.body.mask.div.style.height=documentWH.h;
	}
};
myAttachEvent(window,'resize',resizeWin);

function getDocumentWH(){
	var d = {w:0,h:0};
	if(window.innerHeight&&window.scrollMaxY) d.h=window.innerHeight+window.scrollMaxY;
	else if(document.body.scrollHeight>document.body.offsetHeight) d.h=document.body.scrollHeight;
	else d.h=document.body.offsetHeight+document.body.offsetTop;
	if(window.innerWidth&&window.scrollMaxX) d.w=window.innerWidth+window.scrollMaxX;
	else if(document.body.scrollWidth>document.body.offsetWidth) d.w=document.body.scrollWidth;
	else d.w=document.body.offsetWidth+document.body.offsetLeft;
	return d;
};

lib_jobsearch.fnChangeBg = function(o,c,t){
	if(o&&o.nodeType==1){
		if(t){
			if(o.className.indexOf(c)==-1) o.className+=o.className==''?c:' '+c;
		}
		else{
			if(o.className.indexOf(c)>-1) o.className=o.className.replace(' '+c,'').replace(c,'');
		}
	}
}